<template>
  <OneUserPage route-name="modify_user_page" :t-user="routeQuery" @submit="save"/>
</template>

<script>
import OneUserPage from './one_user_page'
import { mapActions } from 'vuex'
export default {
  components: {
    OneUserPage
  },
  name: 'modify_user_page',
  data () {
    return {
      routeQuery: null
    }
  },
  methods: {
    ...mapActions([
      'handleUpdateUser'
    ]),
    save (user) {
      this.handleUpdateUser(user).then(res => {
        this.$Message.success('更新用户信息成功')
      }).catch(() => this.$Message.error('更新用户信息失败'))
    }
  },
  created () {
    this.routeQuery = this.$route.query
  }
}
</script>
<style scoped>
</style>
